home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / ddutil12.arc / DDUTILS.PAS < prev    next >
Pascal/Delphi Source File  |  1990-08-22  |  6KB  |  240 lines

  1. (***************************************************************************)
  2. (**                                                                       **)
  3. (**              DDUtils By John Richardson and Dan Vanderboom            **)
  4. (**            Copyright 1990 John Richardson and Dan Vanderboom          **)
  5. (**                                                                       **)
  6. (**                         TopSoft Support Systems                       **)
  7. (**                         2135 Possum Ct.                               **)
  8. (**                         Brookfield, Wi 53045                          **)
  9. (**                         (414)796-8408 Data 12/24                      **)
  10. (**                                                                       **)
  11. (**                                                                       **)
  12. (***************************************************************************)
  13. (**                                                                       **)
  14. (**                                                                       **)
  15. (** v1.00: Initial Release.                                               **)
  16. (** v1.10: Added 9 more new procedures/functions.                         **)
  17. (** v1.20: Added                                                          **)
  18. (**                                                                       **)
  19. (***************************************************************************)
  20.  
  21. Unit DDutils;
  22.  
  23. Interface
  24.  
  25. Uses Dos;
  26.  
  27. Function DDActive:Boolean;
  28. Procedure Give_Time(Amount:Integer);
  29. Procedure Task_Off;
  30. Procedure Task_On;
  31. Function Invisible:Boolean;
  32. Procedure Switch;
  33. Procedure Resume_Invisible;
  34. Procedure Kill_Other_Job;
  35. Procedure Suspend_Invisible;
  36. Procedure Clear_KeyBoard_Buffer;
  37. Function Send_Char(Ch:Char):Boolean;
  38. Function Program_Status:Integer;
  39. Function Task_Number:Integer;
  40. Function Other_Status:Integer;
  41. Procedure Time_Sharing(Num:Integer);
  42. Function Current_TimeShare:Integer;
  43.  
  44. {=========================================================================}
  45.  
  46. Implementation
  47.  
  48. {=========================================================================}
  49.  
  50. Function DDActive:Boolean;
  51. Var
  52.    Regs:Registers;
  53. Begin
  54.    Regs.ax := $E400;
  55.    MsDos(Regs);
  56.    If Regs.al <> $00 Then DDActive := True Else DDactive := False;
  57. End;
  58.  
  59. {=========================================================================}
  60.  
  61. Procedure Give_Time(Amount:Integer);
  62. Var
  63.    Regs:Registers;
  64. Begin
  65.    Regs.ah := $EE;
  66.    Regs.al := Amount;
  67.    MsDos(Regs);
  68. End;
  69.  
  70. {=========================================================================}
  71.  
  72. Procedure Task_Off;
  73. Var
  74.    Regs:Registers;
  75. Begin
  76.    Regs.ah := $EA;
  77.    MsDos(Regs);
  78. End;
  79.  
  80. {=========================================================================}
  81.  
  82. Procedure Task_On;
  83. Var
  84.    Regs:Registers;
  85. Begin
  86.    Regs.ah := $EB;
  87.    MsDos(Regs);
  88. End;
  89.  
  90. {=========================================================================}
  91.  
  92. Function Invisible:Boolean;
  93. Var
  94.    Regs:Registers;
  95. Begin
  96.    Regs.ax := $E400;
  97.    MsDos(Regs);
  98.    If Regs.al = $02 Then Invisible := True Else Invisible := False;
  99. End;
  100.  
  101. {=========================================================================}
  102.  
  103. Procedure Switch;
  104. Var
  105.    Regs:Registers;
  106. Begin
  107.    Regs.ah := $E0;
  108.    Regs.al := 1;
  109.    MsDos(Regs);
  110. End;
  111.  
  112. {=========================================================================}
  113.  
  114. Procedure Resume_Invisible;
  115. Var
  116.    Regs:Registers;
  117. Begin
  118.    Regs.ah := $E0;
  119.    Regs.al := $73;
  120.    MsDos(Regs);
  121. End;
  122.  
  123. {=========================================================================}
  124.  
  125. Procedure Kill_Other_Job;
  126. Var
  127.    Regs:Registers;
  128. Begin
  129.    Regs.ah := $E0;
  130.    Regs.al := $74;
  131.    MsDos(Regs);
  132. End;
  133.  
  134. {=========================================================================}
  135.  
  136. Procedure Suspend_Invisible;
  137. Var
  138.    Regs:Registers;
  139. Begin
  140.    Regs.ah := $E0;
  141.    Regs.al := $75;
  142.    MsDos(Regs);
  143. End;
  144.  
  145. {=========================================================================}
  146.  
  147. Procedure Clear_Keyboard_Buffer;
  148. Var
  149.    Regs:Registers;
  150. Begin
  151.    Regs.ah := $E1;
  152.    MsDos(Regs);
  153. End;
  154.  
  155. {=========================================================================}
  156.  
  157. Function Send_Char(Ch:Char):Boolean;
  158. Var
  159.    Regs:Registers;
  160. Begin
  161.    Regs.ah := $E2;
  162.    Regs.dl := Ord(Ch);
  163.    MsDos(Regs);
  164.    If Regs.al = 0 Then Send_Char := True Else Send_Char := False;
  165. End;
  166.  
  167. {=========================================================================}
  168.  
  169. Function Program_Status:Integer;
  170. Var
  171.    Regs:Registers;
  172. Begin
  173.    Regs.ah := $E4;
  174.    MsDos(Regs);
  175.    Program_Status := Regs.al;
  176.    { al = 1 program is visible }
  177.    { al = 1 program is invisibile }
  178.    { al = any other value means DoubleDOS not running }
  179.    { ah = task number (0=top, 1=bottom job) }
  180. End;
  181.  
  182. {=========================================================================}
  183.  
  184. Function Task_Number:Integer;
  185. Var
  186.    Regs:Registers;
  187. Begin
  188.    Regs.ah := $E4;
  189.    MsDos(Regs);
  190.    Task_Number := Regs.ah;  { 0=top, 1=bottom }
  191. End;
  192.  
  193. {=========================================================================}
  194.  
  195. Function Other_Status:Integer;
  196. Var
  197.    Regs:Registers;
  198. Begin
  199.    Regs.ah := $E5;
  200.    MsDos(Regs);
  201.    Other_Status := Regs.al;
  202.    { al = 0 no program running   }
  203.    { al = 1 program is running   }
  204.    { al = 2 program is suspended }
  205. End;
  206.  
  207. {=========================================================================}
  208.  
  209. Procedure Time_Sharing(Num:Integer);
  210. Var
  211.    Regs:Registers;
  212. Begin
  213.    { Num Variable }
  214.    { 0 = visible program gets 70% invisible gets 30% (default) }
  215.    { 1 = visible program gets 50% invisible gets 50% of time }
  216.    { 2 = visible program gets 30% invisible gets 70% of time }
  217.    { 3 = top program gets 70% bottom program gets 30% of time }
  218.    { 4 = top program gets 30% bottom program gets 70% of time }
  219.    { 5 = returns current priotity setting in al }
  220.    Regs.ah := $E9;
  221.    Regs.al := Num;
  222.    MsDos(Regs);
  223. End;
  224.  
  225. {=========================================================================}
  226.  
  227. Function Current_TimeShare:Integer;
  228. Var
  229.    Regs:Registers;
  230. Begin
  231.    Regs.ah := $E9;
  232.    Regs.al := 5;
  233.    MsDos(Regs);
  234.    Current_TimeShare := Regs.al;
  235. End;
  236.  
  237. {=========================================================================}
  238.  
  239. End.
  240.